include ../rules.mk


all: enter  programs leave
	@echo "====> Finished"

enter:
	@echo "==> building in $(HERE)"

leave:
	@echo "==> all done in $(HERE)"

programs : libs mdc mds2xyz

libs:
	@$(MAKE) -s -C ../mds

mdc: $(call to_object,main.c mdc_options.c) ../.libs/libmds.a
	$(LINK)  -lz

mds2xyz: $(call to_object,mds2xyz.c) ../.libs/libmds.a
	$(LINK) -lz

gcc:
	@$(MAKE) rebuild MY_CFLAGS="-O2 -DNDEBUG=1 -ftree-vectorize" MY_LDFLAGS='-static-libgcc'

icc:
	@$(MAKE) rebuild CC=icc MY_CFLAGS="-O2 -DNDEBUG=1"

clang:
	@$(MAKE) rebuild CC=clang MY_CFLAGS="-O2 -DNDEBUG=1"

gcc-omp:
	@$(MAKE) rebuild MY_CFLAGS="-O2 -DNDEBUG=1 -ftree-vectorize -fopenmp" MY_LDFLAGS="-fopenmp"

gcc-omp-dbg:
	@$(MAKE) rebuild MY_CFLAGS="-fopenmp" MY_LDFLAGS="-fopenmp"

	
icc-omp:
	@$(MAKE) rebuild CC=icc MY_CFLAGS="-O2 -DNDEBUG=1 -openmp" MY_LDFLAGS="-openmp"
	
clean:
	$(CLEAN)
	@rm -f mdc mdc.exe benchmark*.txt vf.txt bench*.xyz md.xyz energy.txt
	@rm -f mds2xyz mds2xyz.exe
	
rebuild:
	@$(MAKE) -s -C .. clean && $(MAKE) -s all
	
-include $(DEPENDS)

